/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

:root {
  --primary-color: #ff6b88;
  --primary-light: #ff8fab;
  --primary-dark: #ff4757;
  --secondary-color: #ffccd5;
  --background-light: #fff5f7;
  --text-color: #333;
  --text-light: #666;
  --white: #ffffff;
  --shadow: 0 4px 15px rgba(255, 107, 136, 0.1);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

body {
  background-color: var(--background-light);
  color: var(--text-color);
  line-height: 1.6;
}

/* 应用容器 */
.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px 0;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.app-header h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.app-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* 翻译器主容器 */
.translator-container {
  background-color: var(--white);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--shadow);
  flex-grow: 1;
}

.translator-container h1 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

/* 输入区域 */
.input-section {
  margin-bottom: 25px;
}

.input-section textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--secondary-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
  transition: var(--transition);
  margin-bottom: 15px;
}

.input-section textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(255, 107, 136, 0.2);
}

/* 按钮组 */
.button-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.button-group button {
  flex: 1;
  min-width: 120px;
  padding: 12px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-group button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 语音按钮 */
.button-group button:nth-child(1) {
  background-color: var(--primary-light);
  color: var(--white);
}

.button-group button:nth-child(1):hover:not(:disabled) {
  background-color: var(--primary-color);
}

.button-group button:nth-child(1).listening {
  background-color: var(--primary-dark);
  animation: pulse 1.5s infinite;
}

/* 翻译按钮 */
.button-group button:nth-child(2) {
  background-color: var(--primary-color);
  color: var(--white);
}

.button-group button:nth-child(2):hover:not(:disabled) {
  background-color: var(--primary-dark);
}

/* 清空按钮 */
.button-group button:nth-child(3) {
  background-color: #f1f1f1;
  color: var(--text-color);
}

.button-group button:nth-child(3):hover:not(:disabled) {
  background-color: #e1e1e1;
}

/* 结果区域 */
.result-section {
  background-color: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  border: 2px solid var(--secondary-color);
  margin-bottom: 25px;
}

.result-section h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.result-section p {
  color: var(--primary-dark);
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* 分享区域 */
.share-section {
  margin-top: 20px;
}

.share-button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.share-button:hover {
  background-color: #45a049;
}

/* 规则区域 */
.rules-section {
  background-color: var(--white);
  padding: 20px;
  border-radius: var(--border-radius);
  border: 2px solid var(--secondary-color);
  margin-top: 20px;
}

.rules-section h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rules-section ul {
  list-style-type: none;
}

.rules-section li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--secondary-color);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rules-section li:last-child {
  border-bottom: none;
}

.rules-section li strong {
  color: var(--primary-color);
  font-weight: 600;
}

.rules-section p {
  text-align: center;
  color: var(--text-light);
  margin-top: 10px;
  font-size: 0.9rem;
}

/* 操作按钮 */
.action-buttons {
  margin: 20px 0;
  text-align: center;
}

.action-buttons button {
  background-color: var(--primary-light);
  color: var(--white);
  padding: 12px 20px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-buttons button:hover {
  background-color: var(--primary-color);
}

/* 规则编辑器 */
.rule-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.rule-editor {
  background-color: var(--white);
  padding: 25px;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.rule-editor h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--secondary-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.rule-editor .button-group {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.rule-editor .button-group button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.rule-editor .button-group button:first-child {
  background-color: var(--primary-color);
  color: var(--white);
}

.rule-editor .button-group button:first-child:hover {
  background-color: var(--primary-dark);
}

.rule-editor .button-group button:last-child {
  background-color: #f1f1f1;
  color: var(--text-color);
}

.rule-editor .button-group button:last-child:hover {
  background-color: #e1e1e1;
}

/* 动画 */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app {
    padding: 15px;
  }
  
  .app-header h1 {
    font-size: 1.5rem;
  }
  
  .translator-container {
    padding: 20px 15px;
  }
  
  .button-group button {
    min-width: 100%;
  }
  
  .rules-section li {
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1.3rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .result-section p {
    font-size: 1rem;
  }
}